package main

import "fmt"

func main() {
	//我们想在切片里面放一系列用户的信息，这时候我们就可以定义一个元素为map类型的切片

	//var userinfo = []string{"张三", "李四"}
	//var userinfo = make([]string, 3, 3)
	var userinfo = make([]map[string]string, 2, 2)

	//fmt.Println(userinfo[0]) //map[]

	//fmt.Println(userinfo[0] == nil) //true	map不初始化的默认值nil
	if userinfo[0] == nil {
		userinfo[0] = make(map[string]string)
		userinfo[0]["username"] = "张三"
		userinfo[0]["age"] = "20"
		userinfo[0]["height"] = "180cm"
	}

	if userinfo[1] == nil {
		userinfo[1] = map[string]string{
			"username": "李四",
			"age":      "18",
			"height":   "165cm",
		}
	}

	fmt.Println(userinfo)
}
